import {WxSign} from './ajax';
import wxapi from './wxapi';
import store from './store';
export function share(){
    const data = {
        url:`${window.location.href.split('#')[0]}?admin_id=${store.getters.admin_id}`
    }
    WxSign(data).then(res=>{
    const option = {
        title:"和我一起来发现更多商品",
        link:res.url,
        imgUrl:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1593323559937&di=44c8759502e03395299250c4207f12fb&imgtype=0&src=http%3A%2F%2Fimg1.cache.netease.com%2Fcatchpic%2F3%2F32%2F32C7B6BA1E7E85FB75633B1CAFF470D7.jpg',
        desc:'专注于企业用户的生鲜供应链'
    }
    // console.log(option);
        wxapi.wxRegister(res,option);
    })
};
export function goodsShare(goods){
    const data = {
        url:`${window.location.href.split('#')[0]}?admin_id=${store.getters.admin_id}`
    }
    WxSign(data).then(res=>{
        // console.log("参数获取成功")
        // console.log(res);
        // console.log(goods);
    const option = {
        title:"我发现了一件非常好的商品",
        link:res.url,
        imgUrl:goods.image,
        desc:goods.info
    }
    // console.log(option);
        wxapi.wxRegister(res,option);
    })
}